1. Field of the Invention
The present invention relates to an image generation through a computer, and to a shading processing device which performs shading processing on a CRT image and displays the image.
2. Description of the Related Art
In the field of computer graphics, polygons of respective surfaces of a solid are shaded in accordance with a light source position and an ambient condition, and thereby, more realistic solid expression has been tried.
In the related art, as shading and lighting processing in computer graphics, shading processing with a parallel light source has often been used because an operation processing amount therefor is little. Japanese Laid-Open Patent Application Nos. 61-103277 and 62-204386 disclose shading processing methods for performing a shading processing operation at high speed using a parallel light source.
In the related art, real-time computer graphics are often performed by software which is executed by a digital signal processor (DSP) or the like. However, processing for a point light source or a spotlight is a large operation requiring a large time when the processing is performed by the software executed by the DSP or the like.
Especially, in shading processing using a point light source, when obtaining a normalized unit light-source vector for a polygon vertex and the point light source, as shown in the following equations (1) through (6), root operations are needed for normalizing a light-source vector. These root operations require a large operation time. EQU DX=LPX-PX (1) EQU LNX=DX/{(DX).sup.2 +(DY).sup.2 +(DZ).sup.2 }.sup.1/2 (2) EQU DY=LPY-PY (3) EQU LNY=DY/{(DX).sup.2 +(DY).sup.2 +(DZ).sup.2 }.sup.1/2 (4) EQU DZ=LPZ-PZ (5) EQU LNZ=DZ/{(DX).sup.2 +(DY).sup.2 +(DZ).sup.2 }.sup.1/2 (6)
In the equations, DX represents the X value of the light-source vector; PX represents the X address value of the polygon vertex; LPX represents the X address value of the point light source; LNX represents the X value of the normalized light-source vector; DY represents the Y value of the light-source vector; PY represents the Y address value of the polygon vertex; LPY represents the Y address value of the point light source; LNY represents the Y value of the normalized light-source vector; DZ represents the Z value of the light-source vector; PZ represents the Z address value of the polygon vertex; LPZ represents the Z address value of the point light source; and LNZ represents the Z value of the normalized light-source vector.
In a case where the root operation processing shown in the equations (1) through (6) is performed by hardware, basically a large hardware is required.
In ordinary full color computer graphics, 8-bit precision for each of R, G and B is sufficient, and, in shading processing, very high precision is not needed.